package user

import (
	"day12_11_homework/internal/models/response"
	"github.com/gin-gonic/gin"
	"net/http"
	"strconv"
)

type UpdateStatusRequest struct {
	Id string `json:"id" binding:"required"`
}

func UpdateStatus(c *gin.Context) {

	var up UpdateStatusRequest

	if err := c.ShouldBindJSON(&up); err != nil {
		c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
		return
	}

	Id, _ := strconv.Atoi(up.Id)

	statusResponse := response.UpdateStatusResponse(Id)

	if statusResponse != "" {
		c.JSON(500, gin.H{
			"message": statusResponse,
		})
		return
	}

	c.JSON(200, gin.H{
		"message": "修改成功",
	})

}
